#ifndef STATE_MACHINE_H
#define STATE_MACHINE_H

#include <map>
using std::map;

class State;

class StateMachine {

	public:
		StateMachine();
		~StateMachine();
		
		bool registState(LEX_STATE lst, State *state);
		bool setInitState(LEX_STATE lst);
		void initState() { _state = _initState; }
		void changeState(LEX_STATE lst) { _state = lst; }
		bool hasState(LEX_STATE lst);
		bool atInitState() { return _state == _initState; }
		
		bool  accept(OutputStream &out, InputStream &in, int ch);
		Token getToken();

	private:
		LEX_STATE   _initState;
		LEX_STATE   _state;
		map<LEX_STATE, State*> _state_map;
};

#endif
